package com.zoe.tree.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zoe.tree.entity.SysDept;
import org.apache.ibatis.annotations.Param;

/**
 * @author zbg
 * @date 2023/06/20
 * @description $description
 */
public interface SysDeptMapper extends BaseMapper<SysDept> {


    Integer getMaxSort(@Param("pid") Long pid);

    /**
     * @param pid
     * @param newSort
     * @param oldSort
     * @return
     */
    Integer peerUpperSort(@Param("pid") Long pid,
                          @Param("newSort") Integer newSort,
                          @Param("oldSort") Integer oldSort);

    /**
     * @param pid
     * @param newSort
     * @param oldSort
     * @return
     */
    Integer peerDownSort(@Param("pid") Long pid,
                         @Param("newSort") Integer newSort,
                         @Param("oldSort") Integer oldSort);

    /**
     * @param pid
     * @param oldSort
     * @return
     */
    Integer downSort(@Param("pid") Long pid,
                     @Param("oldSort") Integer oldSort);

    /**
     * @param pid
     * @param newSort
     * @return
     */
    Integer upperSort(@Param("pid") Long pid, @Param("newSort") Integer newSort);
}